/*
 * Project Name: jmax
 * File Name: DeviceMonitorClient.java
 * Copyright: Copyright(C) 1985-2015 ZKTeco Inc. All rights reserved.
 */
package com.xdtech.hotel.monitor;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.xdtech.hotel.protocol.manager.DeviceMonitor;
import com.xdtech.hotel.protocol.vo.RCUDevice;
import com.xdtech.hotel.util.RedisUtils;

/**
 * 设备监控
 * @version TODO 添加版本
 * @see 相关类或方法，不需要请删除此行
 * @since 2015-4-24 下午2:54:14
 */
public class DeviceMonitorClient extends Client
{
	public DeviceMonitorClient(String id)
	{
		super(id);
	}
	
	private List<RCUDevice> rcuDevices =  Collections.synchronizedList(new ArrayList<RCUDevice>());

	public List<RCUDevice> getRcuDevices()
	{
		return rcuDevices;
	}

	public void setRcuDevices(List<RCUDevice> rcuDevices)
	{
		this.rcuDevices = rcuDevices;
	}
	
	public List<RCUDevice> clientGetRcuDevices()
	{
		List<RCUDevice> rcuDevicesToClientList = new ArrayList<RCUDevice>(this.rcuDevices);
		setLastAccessedTime(System.currentTimeMillis());
		rcuDevices.clear();
		return rcuDevicesToClientList;
	}
	/**
	 * 新创建的客户端，获取是所有的设备信息
	 * @author max.zheng
	 * @since 2015-4-24 下午3:23:06
	 */
	public void loadAllDeviceMonitors()
	{
//		rcuDevices.addAll(RedisUtils.getAllDevStatusInfo());
		
		rcuDevices.addAll(DeviceMonitor.monitorDevices.values());
	}
}
